<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>

        function yueShuHe(num) {
            var sum = 0
            for (var i = 1; i < num; i++) {
                if (num % i == 0 && num != i) {
                    sum += i
                }
            }
            return sum
        }

        function fun() {
            for (var i = 1; i <= 2000; i++) {
                for (var j = 1; j <= i; j++) {
                    if (yueShuHe(i) == j && yueShuHe(j) == i && i != j) {
                        console.log(i + "和" + j + "是亲密数");
                    }
                }
            }

        }

        fun()
    </script>
</head>

<body>

</body>

</html>